package lang

import "fmt"

// PathError records an error and the operation and
// file path that caused it.
type PathError struct {
	Op   string // "open", "unlink", etc.
	Path string // The associated file.
}

func (e *PathError) Error() string {
	return e.Op + " " + e.Path
}

func mainError() {
	defer func() {
		if e := recover(); e != nil {
			fmt.Println(e)
		}
	}()
	_, err := returnError()
	if err != nil {
		panic(err.Error())
	}

}

func returnError() (ret interface{}, err error) {
	return nil, &PathError{Op: "open", Path: "/root"}
}
